
export function run() {
    let ws = new WebSocket("ws://127.0.0.1:8080/websocket", "default");

    console.log("websocket connecting:", ws.url);

    ws.onopen = function () {
        console.log("[ws.onopen]", ws.readyState);
        let count = 0;
        setInterval(function () {
            ws.send("websocket message test" + count++);
        }, 1000);
    };
    ws.onclose = function () {
        console.log("[ws.onclose]", ws.readyState);
    };
    ws.onerror = function (err) {
        console.log("[ws.onerror]", err);
    };
    ws.onmessage = function (msg) {
        console.log("[ws.recv]", msg);
    };
}
